using System;

namespace Microsoft.PowerShell.CmdletManagement
{
    /// <summary>
    /// A class that represents a Cmdlet ParameterSet Entry
    /// </summary>
    public class PsSpecCmdletParameterSetEntry : ICloneable, IEquatable<PsSpecCmdletParameterSetEntry>
    {
        public PsSpecCmdletParameterSetEntry() { }

        public PsSpecCmdletParameterSetEntry(
            int id, string parameterSetName, string parameterName, string cmdletName, string projectName,
            bool mandatory, int? position, bool valueFromPipeline, bool valueFromPipelineByPropertyName,
            bool valueFromRemainingArguments, string helpMessage, string helpMessageBaseName, string helpMessageResourceId, int parameterId)
        {
            this.parameterSetEntryId = id;
            this.projectName = projectName;
            this.cmdletName = cmdletName;
            this.parameterName = parameterName;
            this.parameterSetName = parameterSetName;
            this.mandatory = mandatory;
            this.position = position;
            this.valueFromPipeline = valueFromPipeline;
            this.valueFromPipelineByPropertyName = valueFromPipelineByPropertyName;
            this.valueFromRemainingArguments = valueFromRemainingArguments;
            this.helpMessage = helpMessage;
            this.helpMessageBaseName = helpMessageBaseName;
            this.helpMessageResourceId = helpMessageResourceId;
            this.parameterId = parameterId;
        }

        public int Id
        {
            get { return parameterSetEntryId; }
            set { parameterSetEntryId = value; }
        }
        private int parameterSetEntryId = 0;

        public string ProjectName
        {
            get { return projectName; }
            set { projectName = value; }
        }
        private string projectName = null;

        public string CmdletName
        {
            get { return cmdletName; }
            set { cmdletName = value; }
        }
        private string cmdletName = null;

        public string ParameterName
        {
            get { return parameterName; }
            set { parameterName = value; }
        }
        private string parameterName = null;

        public int ParameterId
        {
            get { return parameterId; }
            set { parameterId = value; }
        }
        private int parameterId = -1;

        public string ParameterSetName
        {
            get 
            {
                if (String.IsNullOrEmpty(parameterSetName)) return null;
                else return parameterSetName; 
            }
            set { parameterSetName = value; }
        }
        private string parameterSetName = null;

        public bool Mandatory
        {
            get
            {
                return mandatory;
            }
            set
            {
                mandatory = value;
            }
        }
        private bool mandatory = false;

        public int? Position
        {
            get { return position; }
            set { position = value; }
        }
        private int? position = null;

        public bool ValueFromPipeline
        {
            get
            {
                return valueFromPipeline;
            }
            set
            {
                valueFromPipeline = value;
            }
        }
        private bool valueFromPipeline = false;

        public bool ValueFromPipelineByPropertyName
        {
            get
            {
                return valueFromPipelineByPropertyName;
            }
            set
            {
                valueFromPipelineByPropertyName = value;
            }
        }
        private bool valueFromPipelineByPropertyName = false;

        public bool ValueFromRemainingArguments
        {
            get
            {
                return valueFromRemainingArguments;
            }
            set
            {
                valueFromRemainingArguments = value;
            }
        }
        private bool valueFromRemainingArguments = false;

        public string HelpMessage
        {
            get 
            {
                if (String.IsNullOrEmpty(helpMessage)) return null;
                else return helpMessage; 
            }
            set { helpMessage = value; }
        }
        private string helpMessage;

        public string HelpMessageBaseName
        {
            get 
            {
                if (String.IsNullOrEmpty(helpMessageBaseName)) return null;
                else return helpMessageBaseName; 
            }
            set { helpMessageBaseName = value; }
        }
        private string helpMessageBaseName;

        public string HelpMessageResourceId
        {
            get 
            {
                if (String.IsNullOrEmpty(helpMessageResourceId)) return null;
                else return helpMessageResourceId; 
            }
            set { helpMessageResourceId = value; }
        }
        private string helpMessageResourceId;

        public Object Clone()
        {
            return this.MemberwiseClone();
        }

        #region IEquatable<PsSpecCmdletParameterSetEntry> Members

        public bool Equals(PsSpecCmdletParameterSetEntry other)
        {
            if (other == null)
            {
                return false;
            }

            if ((this.Id == other.Id) &&
                (this.ProjectName == other.ProjectName) &&
                (this.CmdletName == other.CmdletName) &&
                (this.ParameterName == other.ParameterName) &&
                (this.ParameterSetName == other.ParameterSetName) &&
                (this.Mandatory == other.Mandatory) &&
                (this.Position == other.Position) &&
                (this.ValueFromPipeline == other.ValueFromPipeline) &&
                (this.ValueFromPipelineByPropertyName == other.ValueFromPipelineByPropertyName) &&
                (this.ValueFromRemainingArguments == other.ValueFromRemainingArguments) &&
                (this.HelpMessage == other.HelpMessage) &&
                (this.HelpMessageBaseName == other.HelpMessageBaseName) &&
                (this.HelpMessageResourceId == other.HelpMessageResourceId) &&
                (this.parameterId == other.parameterId))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion
    }
}